/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.tramite.bc;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.cip.esymons.colegiatura.be.Colegiado;
import org.cip.esymons.tramite.be.RecepAutoCert;

/**
 *
 * @author Cristian
 */
@Stateless
public class RecepAutoCertFacade implements RecepAutoCertFacadeLocal {
    @PersistenceContext
    private EntityManager em;

    public void create(RecepAutoCert recepAutoCert) {
        em.persist(recepAutoCert);
    }

    public void edit(RecepAutoCert recepAutoCert) {
        em.merge(recepAutoCert);
    }

    public void remove(RecepAutoCert recepAutoCert) {
        em.remove(em.merge(recepAutoCert));
    }

    public RecepAutoCert find(Object id) {
        return em.find(RecepAutoCert.class, id);
    }

    public List<RecepAutoCert> findAll() {
        return em.createQuery("select object(o) from RecepAutoCert as o").getResultList();
    }

    public List<RecepAutoCert> listarXColegiado(Colegiado col) {
        return em.createQuery("select object(o) from RecepAutoCert as o where o.fkSolCodigocol=?1").setParameter(1, col).getResultList();
    }

}
